home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Games / dinkum3 / objlook.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-03  |  17.2 KB  |  521 lines

  1. #define OBJLKR
  2. #include "dink_sym.h"
  3. #include "dink_glb.h"
  4.  
  5. #if (PROTOTYPE)
  6. void objlooker(int n)
  7. #else
  8. objlooker(n)
  9. int n ;
  10. #endif
  11. /*********************************************************/
  12. /*                                                       */
  13. /*    --- Object in Room Examination Subroutine ---      */
  14. /*                                                       */
  15. /*      Program by Gary A. Allen, Jr.  18 May 1990       */
  16. /*        (c) Copyright 1992 by Gary A. Allen, Jr.       */
  17. /*                                                       */
  18. /*********************************************************/
  19. {
  20. register int i ;
  21. OBJECT_STRUCT *pnt ;
  22.  
  23. #if (PROTOTYPE)
  24. void objector(OBJECT_STRUCT*) ;
  25. #endif
  26.  
  27. if (((Torch->Location == B_have) && Torch->Status) || 
  28.    (n < 186) || (n > 202)) { 
  29.     if (room[n][M_obj_cnt] == 1) {
  30.         pnt = object ; /* initialize the pointer */
  31.         for (i = 0; i < Objcnt; i++) {
  32.             if ((pnt->Location == n)&&(pnt->Type != Z_unmovable)) {
  33.                 if (n == R_office_mang) {
  34.                     printf("On the floor you see ") ;
  35.                     objector(pnt) ;
  36.                     printf (".\n") ;
  37.                 }
  38.                 else {
  39.                      printf("You see ") ;
  40.                     objector(pnt) ;
  41.                     printf (".\n") ;
  42.                 }
  43.             }
  44.             pnt++ ;
  45.         }
  46.     }
  47.     if (room[n][M_obj_cnt] > 1) {
  48.         if (n == R_office_mang) 
  49. printf ("You see the following on the floor: \n");
  50.         else printf ("You see the following: \n");
  51.         pnt = object ; /* initialize the pointer */
  52.         for (i = 0; i < Objcnt; i++) {
  53.             if ((pnt->Location == n)&&(pnt->Type != Z_unmovable)) {
  54.                 printf ("        ") ;
  55.                 objector(pnt) ;
  56.                 printf ("\n") ;
  57.             }
  58.             pnt++ ;
  59.         }
  60.     }
  61. }
  62. } /* end of "objlooker" subroutine */
  63.  
  64. #if (PROTOTYPE)
  65. void kelly(int n)
  66. #else
  67. kelly(n) 
  68. int n ;
  69. #endif
  70. /********************************************************************/
  71. /*                                                                  */
  72. /*                  --- Ned Kelly Subroutine --                     */
  73. /*                                                                  */
  74. /* Software by Gary A. Allen, Jr. 5 November 1989  Version: Mk 1.2  */
  75. /*           (c) Copyright 1989 by Gary A. Allen, Jr.               */
  76. /*                                                                  */
  77. /********************************************************************/
  78. {
  79. register int i, k ;
  80. static int ned_look = 0, sw_fiddle = TRUE ;
  81. int  sw_ned_look, sw_ned_set ;
  82. OBJECT_STRUCT *pnt ;
  83.  
  84. /* check if Ned  Kelly is dead */
  85. if (Ned->Location == B_destroyed) return ;
  86.  
  87. /* this switch is for Ned looking for treasure once per cycle */
  88. sw_ned_look = FALSE ;
  89. sw_ned_set = FALSE ;
  90.  
  91. /* check if player is in Ned's trigger rooms */
  92. switch (n) {
  93. /* Cause Ned Kelly to steal */
  94. case R_lift_inside:
  95.     /* are there valuables in the safe and the safe open? */
  96.     if ((score > 0) && (Safe->Status != S_closed)) {
  97.     /* is the office building open? */
  98.         if ((ned_look > 3)||(Door->Status == S_open)
  99.                 ||(Door->Status == S_kicked)
  100.                 ||(Door->Status == S_unlocked)) {
  101.  
  102.             if (ned_look > 3) {
  103.                 Door->Status = S_kicked ;
  104.                 room[R_office_entr][2] = R_office_hall ;
  105.             }
  106.  
  107. /* scan the object list for treasure in safe and transfer to hideout */
  108.             pnt = object ; /* initialize the pointer */
  109.             for (i = 0; i < Objcnt; i++) {
  110.                 if ((pnt->Location == B_in_safe)
  111.                         && (pnt->Value > 0)) {
  112.                     ++room[R_hideout][M_obj_cnt] ;
  113.                     pnt->Location = R_hideout; 
  114.                     sw_ned_set = TRUE ;
  115.                     Picture->Status = S_open ;
  116.                 }
  117.                 pnt++ ;
  118.             }    
  119.         }
  120. /* the safe is open with treasure but the door is locked */
  121.         else {
  122.             ++ned_look ;
  123.             sw_ned_look = TRUE ;
  124.         }
  125.     } /* end of the block concerning Ned and the safe */
  126.  
  127.     if (sw_valuable) {
  128.         pnt = object ; /* initialize the pointer */
  129.         for (i = 0; i < Objcnt; i++) {
  130. /* scan for treasure laying around outside the building on surface */
  131.             for (k = 22; k <= 36; k++) { 
  132.                 if ((pnt->Location == k)
  133.                     &&(pnt->Value > 0)) {
  134.                     ++room[R_hideout][M_obj_cnt] ;
  135.                     --room[k][M_obj_cnt] ;
  136.                     pnt->Location = R_hideout; 
  137.                     sw_ned_set = TRUE ;
  138.                     sw_valuable = FALSE ;
  139.                     break ;
  140.                 }
  141.             }    
  142.             for (k = 144; k <= 145; k++) {
  143.                 if ((pnt->Location == k)&&
  144.                     (pnt->Value > 0)) {
  145.                     ++room[R_hideout][M_obj_cnt] ;
  146.                     --room[k][M_obj_cnt] ;
  147.                     pnt->Location = R_hideout; 
  148.                     sw_valuable = FALSE ;
  149.                     sw_ned_set = TRUE ;
  150.                     break ;
  151.                 }
  152.             }    
  153.         /* scan the office building for treasure on the floor */
  154.             for (k = 37; k <= 41; k++) { 
  155.                 if ((pnt->Location == k)&&
  156.                     (pnt->Value > 0)) {
  157. /* if the office bldg. door is open then Ned Kelly steals treasure */
  158.         if ((Door->Status == S_open)||(Door->Status == S_unlocked)
  159.                 ||(Door->Status == S_kicked)) {
  160.             ++room[R_hideout][M_obj_cnt] ;
  161.             --room[k][M_obj_cnt] ;
  162.             pnt->Location = R_hideout; 
  163.             sw_valuable = FALSE ;
  164.             sw_ned_set = TRUE ;
  165.             break ;
  166.         }
  167. /* if Ned Kelly sees locked treasure four times, he kicks in the door */
  168.         if (ned_look > 3) {
  169.             Door->Status = S_kicked ;
  170.             room[R_office_entr][2] = R_office_hall ;
  171.             ++room[R_hideout][M_obj_cnt] ;
  172.             --room[k][M_obj_cnt] ;
  173.             pnt->Location = R_hideout; 
  174.             sw_valuable = FALSE ;
  175.             sw_ned_set = TRUE ;
  176.         }
  177.         else {
  178.             if (!sw_ned_look) ++ned_look ;
  179.             sw_ned_look = TRUE ;
  180.             break ; /* conclude the office bldg. loop */
  181.         }
  182.         break ;
  183.                 }
  184.             }    
  185.             pnt++ ;
  186.         }    
  187.     } /* end of block concerning Ned and loose treasure */
  188.  
  189.     if (sw_ned_set) {
  190.         Ned->Status = F_stealing ; 
  191.         Ned->Location = R_hideout ;
  192.         room[R_hideout][M_monster] = 1 ;
  193.         sw_ned_set = FALSE ;
  194.     }
  195.     return ;
  196.  
  197. case R_office_entr:
  198. /* Cause Ned Kelly to run away with treasure */
  199.     if (Ned->Status == F_stealing) {
  200.         Ned->Status = F_asleep ;
  201. printf("There is an odd looking character with an iron bucket on his ");
  202. printf("head and a swag\n");
  203. printf("bag over his shoulder running away from the ");
  204. printf("office building towards\nthe desert. \n\n") ;
  205.         return ;
  206.     }
  207.     if ((ned_look == 2) && sw_fiddle && (Door->Status != S_open)
  208.             &&(Door->Status != S_kicked)
  209.             &&(Door->Status != S_unlocked)) {
  210.         sw_fiddle = FALSE ;
  211. printf("As you approach the office building's door, you see a\n");
  212. printf("strange looking character with a bucket on his head and\n") ;
  213. printf("wearing an iron breast plate.  He is on his knees before\n") ;
  214. printf("the door trying to pick the lock with a bit of coat hanger\n") ;
  215. printf("wire. Suddenly, he turns and sees you coming. With amazing\n"); 
  216. printf("speed, he throws away his wire and runs off towards the\n") ;
  217. printf("open desert.\n\n") ;
  218.         return ;
  219.     }
  220. } /* end of the ned kelly room switch block */
  221. } /* --- end of the "kelly" subroutine  --- */ 
  222.  
  223. #if (PROTOTYPE)
  224. void sounder(int n)
  225. #else
  226. sounder(n) 
  227. int n ;
  228. #endif
  229. /********************************************************************/
  230. /*                                                                  */
  231. /*                  --- Gong Sounding Subroutine --                 */
  232. /*                                                                  */
  233. /* Software by Gary A. Allen, Jr. 21 June 1989     Version: Mk 1.0  */
  234. /*           (c) Copyright 1989 by Gary A. Allen, Jr.               */
  235. /*                                                                  */
  236. /********************************************************************/
  237. {
  238. #if (PROTOTYPE)
  239. void exit(int), hold_it(void) ;
  240. void los_angeles(void) ;
  241. char getche(void) ;
  242. #endif
  243.  
  244. char letter ;
  245.  
  246. /* see if player is in the gong room */
  247. if (n != R_gong) {
  248.     if (tag[V_gong]) printf("I don't see a gong here.\n") ;
  249.     else printf("I don't see how you can do that.\n") ;
  250.     return ;
  251. }
  252.  
  253. /* The player is in the gong room. Does he have the clapper? */
  254. if (tag[V_clapper]) {
  255.     if (Clapper->Location == B_have) {
  256.         if (!tag[V_gong]) {
  257. printf("With what are you going to do that with the clapper?\n") ;
  258.             return ;
  259.         }
  260. printf
  261. ("\n  GGGGGGGG       OOOOOOOO     NN       NN     GGGGGGGG     !!!\n") ;
  262. printf
  263. ("GG        GG   OO        OO   NNN      NN   GG        GG   !!!\n") ;
  264. printf
  265. ("GG             OO        OO   NN N     NN   GG             !!!\n") ;
  266. printf
  267. ("GG             OO        OO   NN  N    NN   GG             !!!\n") ;
  268. printf
  269. ("GG   GGGGGGG   OO        OO   NN   N   NN   GG    GGGGGG   !!!\n") ;
  270. printf
  271. ("GG        GG   OO        OO   NN    N  NN   GG        GG   !!!\n") ;
  272. printf
  273. ("GG        GG   OO        OO   NN     N NN   GG        GG\n") ;
  274. printf
  275. ("GG        GG   OO        OO   NN      NNN   GG        GG   000\n") ;
  276. printf
  277. ("  GGGGGGGG       OOOOOOOO     NN       NN     GGGGGGGG     000\n\n") ;
  278.  
  279. /* see if the "end game" can begine */
  280.         /* Check to see if the recorder was used */
  281.         if (Gong->Status == S_recorder) {
  282. printf("You hear an ethereal voice which says:\n\n") ;
  283. printf("Sorry Mate!  You used the bloody data recorder which gave you\n") ;
  284. printf("an unfair advantage.  If you want to be admitted into the final\n") ;
  285. printf("part of Dinkum and have a chance at winning then you must find\n") ;
  286. printf("all the treasure, come back here and sound the gong WITHOUT having\n") ;
  287. printf("started Dinkum with the command switch \"-S\" (NO data recorder).\n\n");
  288. printf("You did however put in a good effort.  Better luck next time!\n") ;
  289.             Gong->Status = S_told ;
  290.             return ;
  291.         }
  292.         if (Gong->Status == S_told) {
  293.             printf("Nothing happened.\n") ;
  294.             return ;
  295.         }
  296.  
  297.         /* No recorder so admit player to endgame */
  298.         if ((score < max_score)||(Tank->Status == 0)) {
  299. printf("You hear an ethereal voice which says:\n\n") ;
  300.             if (score < max_score) {
  301. printf("Sorry Mate!  You haven't put all of the treasure in the\n") ;
  302. printf("safe yet.  Find the rest, and then the secret of the gong\n") ;
  303. printf("will be revealed.\n") ;
  304.                 return ;
  305.             }
  306.             if (Tank->Status == 0) {
  307. printf("Good on you Mate!  You've found all of the treasure.\n") ;
  308. printf("However you haven't put a single gleep in the gleep tank!\n");
  309. printf("You're not a Fair Dinkum Adventurer until you've put at\n") ;
  310. printf("least one gleep in the tank.\n") ;
  311.                 return ;
  312.             }
  313.         }
  314.         /* Begin the End Game */
  315. printf("There is a loud \"Fromp!\" as a portcullis crashes down and\n");
  316. printf("seals the northern (and only) exit.  The lights go dim and\n");
  317. printf("a hazy fog appears in the room.  Slowly this fog coalesces\n") ;
  318. if (sw_warned) {
  319. printf("into the now familiar form of Banjo Patterson.  For some\n") ;
  320. printf("odd reason Banjo is holding in his right hand a sword of\n") ;
  321. printf("fire such as one reads about in Genesis. The deathly quiet\n");
  322. printf("is broken when Banjo begins to speak:\n") ;
  323. }
  324. else {
  325. printf("into a ghostly human form.  This ethereal being is wearing\n") ;
  326. printf("a grey flannel suit, a bowler hat, and has a gold pocket\n") ;
  327. printf("watch chain looped across the front of his waist coat.  He\n");
  328. printf("is holding in his right hand a sword of fire such as one\n") ;
  329. printf("reads about in Genesis.  You can hear \"Waltzing Matilda\"\n");
  330. printf("being played softly in the background.  You know what?\n");
  331. printf("I think this ethereal being is none other than the ghost\n") ;
  332. printf("of Banjo Patterson!  With this realization Banjo begins to\n") ;
  333. printf("speak:\n") ;
  334. }
  335.         hold_it() ;
  336. printf("\"Good on you, Fair Dinkum Adventurer!  You have braved\n") ; 
  337. printf("the perils of hoop snakes, drop bears, and mutant wombats.\n") ;
  338. printf("You have solved many riddles, collected much treasure and\n") ;
  339. printf("encountered true evil and dealt with it appropriately.\n");
  340. printf("However it has occured to us that you might not be one of\n") ;
  341. printf("the chosen few who can be admitted into the Land of the\n") ;
  342. printf("Blessed.  The possibility remains that you could be a\n") ;
  343. printf("whinging Pom or a bleeding Yank.  Therefore you will be\n") ;
  344. printf("tested with three questions.  If you answer correctly, you\n") ;
  345. printf("will be admitted into paradise. However should you answer\n");
  346. printf("falsely, you will be sent to another place, an abode of\n");
  347. printf("darkness and dread.  So answer wisely, for you will not be\n") ;
  348. printf("given a second chance!\"\n\n") ;
  349.  
  350. printf("What is the capital of Australia?\n\n") ;
  351. printf("     A) Sydney\n") ;
  352. printf("     B) Canberra\n") ;
  353. printf("     C) Melbourne\n\n") ;
  354. printf("Answer A, B, or C:  ") ;
  355. #ifndef __TURBOC__
  356.         for(;;) {
  357.             letter = getchar() ;
  358.             if ((letter != '\n')&&(letter != ' ')) break ;
  359.         }
  360.         if (('b' == letter)||('B' == letter)) 
  361.             printf("\nCorrect!\n\n") ;
  362. #endif
  363.  
  364. #ifdef __TURBOC__
  365.         for(;;) {
  366.             letter = getche() ;
  367.             if ((letter != '\n')&&(letter != ' ')) break ;
  368.         }
  369.         if (('b' == letter)||('B' == letter)) 
  370.             printf("\n\nCorrect!\n\n") ;
  371. #endif
  372.         else {
  373.             los_angeles() ;
  374.             return ;
  375.         }
  376.  
  377. printf("In the Australian emblem there appears two animals on\n") ;
  378. printf("either side of a shield.  One of the two animals is a\n") ;
  379. printf("kangaroo.  What species is the other animal?\n\n") ;
  380. printf("     A) Koala Bear\n") ;
  381. printf("     B) Platypus\n") ;
  382. printf("     C) Emu\n\n") ;
  383. printf("Answer A, B, or C:  ") ;
  384. #ifndef __TURBOC__
  385.         for(;;) {
  386.             letter = getchar() ;
  387.             if ((letter != '\n')&&(letter != ' ')) break ;
  388.         }
  389.         if (('c' == letter)||('C' == letter)) 
  390.             printf("\nCorrect!\n\n") ;
  391. #endif
  392.  
  393. #ifdef __TURBOC__
  394.         for(;;) {
  395.             letter = getche() ;
  396.             if ((letter != '\n')&&(letter != ' ')) break ;
  397.         }
  398.         if (('c' == letter)||('C' == letter)) 
  399.             printf("\n\nCorrect!\n\n") ;
  400. #endif
  401.         else {
  402.             los_angeles() ;
  403.             return ;
  404.         }
  405.  
  406. printf("Which place is a state in Australia?\n\n") ;
  407. printf("     A) Arcadia\n") ;
  408. printf("     B) Patagonia\n") ;
  409. printf("     C) Tasmania\n\n") ;
  410. printf("Answer A, B, or C:  ") ;
  411. #ifndef __TURBOC__
  412.         for(;;) {
  413.             letter = getchar() ;
  414.             if ((letter != '\n')&&(letter != ' ')) break ;
  415.         }
  416.         if (('c' == letter)||('C' == letter)) 
  417.             printf("\nCorrect!\n\n") ;
  418. #endif
  419.  
  420. #ifdef __TURBOC__
  421.         for(;;) {
  422.             letter = getche() ;
  423.             if ((letter != '\n')&&(letter != ' ')) break ;
  424.         }
  425.         if (('c' == letter)||('C' == letter)) 
  426.             printf("\n\nCorrect!\n\n") ;
  427. #endif
  428.         else {
  429.             los_angeles() ;
  430.             return ;
  431.         }
  432.  
  433. /* Player has won the game */
  434. printf("You see Banjo Patterson with a beatific smile.  He waves\n") ;
  435. printf("his firey sword with a florish and the scene around you\n") ;
  436. printf("dissolves into a million tiny motes of light.  You now\n") ;
  437. printf("find yourself wearing swimming togs.  You are being carried\n");
  438. printf("by a guard of honour made up of four sumptuous shielas\n") ;
  439. printf("dressed in string bikinis and four handsome lifeguards.\n") ;
  440. printf("They carry you to a perfect beach on South Stradbroke\n") ;
  441. printf("Island.  Off in the distance on the Queensland mainland\n") ;
  442. printf("you see the Gold Coast which vaguely resembles the Emerald\n") ;
  443. printf("City of the classic movie.  Your guard of honour sets you\n") ;
  444. printf("down and hands you a can of Power's Bitter.  Three\n") ;
  445. printf("beautiful white pelicans float over head in a clear blue\n") ;
  446. printf("sky completing a scene of exquisite beauty.\n\n") ;
  447. printf("You're in paradise Mate and you've also won the game!\n\n") ;
  448.  
  449. /* deal with final gleep announcement */
  450. if (Tank->Status == 1) {
  451. printf("---- A hint for those who want to go on playing Dinkum ----\n");
  452. printf("In this game you only put the minimum single gleep in the\n");
  453. printf("gleep tank.  In future games try seeding fertile tunnels\n");
  454. printf("with gleeps and reproducing them.  Build up as many gleeps\n");
  455. printf("as you can and then hit the gong before Dinkum times out.\n");
  456. }
  457. else {
  458. printf("You won this game with %d gleeps in the gleep tank.\n\n",
  459.     Tank->Status) ;
  460. }
  461.         if (sw_wizard) return ;
  462.         else exit(0) ;
  463.     }
  464.     else {
  465.         printf("I don't have a clapper to hit it with! \n") ;
  466.         return ;
  467.     }
  468. }
  469. else {
  470.     printf("\nThud!\n\n") ;
  471.     printf("Nothing happened.\n") ;
  472. printf("I think you'd have more success if you used a gong clapper.\n");
  473.     return ;
  474. }
  475. } /* --- end of the "sounder" subroutine  --- */ 
  476.  
  477. #if (PROTOTYPE)
  478. void los_angeles(void)
  479. #else
  480. los_angeles()
  481. #endif
  482. /********************************************************************/
  483. /*                                                                  */
  484. /*                 --- Los Angeles Subroutine --                    */
  485. /*                                                                  */
  486. /*       Player enters false answer and goes to Los Angeles.        */
  487. /*                                                                  */
  488. /* Software by Gary A. Allen, Jr. 7 December 1992  Version: Mk 1.0  */
  489. /*           (c) Copyright 1992 by Gary A. Allen, Jr.               */
  490. /*                                                                  */
  491. /********************************************************************/
  492. {
  493. #if (PROTOTYPE)
  494. void exit(int) ;
  495. #endif
  496.  
  497. printf("\n        -!-!-!-!-!-     Wrong!    -!-!-!-!-!-\n\n") ;
  498. printf("Banjo Patterson brings down the sword of fire onto your\n");
  499. printf("head. The scene around you disappears in a flash and you\n");
  500. printf("find yourself transported to.....\n\n") ;
  501. printf("             Pico Blvd., West Los Angeles\n\n") ;
  502. printf("L.A. is having a stage three smog alert.  The air is so\n");
  503. printf("foul you can taste it.  A Los Angeles municipal bus roars\n");
  504. printf("by covering you in soot.  Across the street you see a\n");
  505. printf("modern day Neanderthal selling vials of Crack to children.\n"); 
  506. printf("The person next to you has taken a definite physical\n");
  507. printf("interest in you.  She/he is wearing a short skirt and has a\n");
  508. printf("beehive hairdo.  He/she also has a five o'clock shadow, and\n");
  509. printf("bicepts so thick that he could collapse your skull with a\n");
  510. printf("single thump.\n\n") ; 
  511. printf("We now leave this unhappy scene.  Since you were sent to\n") ;
  512. printf("Los Angeles your score has been zeroed.\n\n") ; 
  513. printf("So ends yet another unsuccessful session at Dinkum!\n") ;
  514.  
  515. if (sw_wizard) return ;
  516. else exit(0) ;
  517.  
  518. } /* --- end of the "los_angeles" subroutine  --- */ 
  519.  
  520.  
  521.